Dashboard Temp Share Shortlinks Frames API

HTMLify

Complete Sum.cpp(CN)
Views: 2 | Author: cody
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include <bits/stdc++.h> 
vector<int> completeSum(vector<int> &a, int n) {
    // Write your code here.
    int i =0;
    vector<int>v;
    int ans =0;
    while(i<n){
         ans = ans + a[i];
         v.push_back(ans);
         i++; 
    }
    return v;
}